// 测试中文字符在JSON中的编码
const body1 = {
  batch_name: '用户佣金提现',
  batch_remark: '佣金提现',
  transfer_remark: '佣金提现'
};

const body2 = {
  batch_name: 'User Commission Withdrawal',
  batch_remark: 'Commission Withdrawal',
  transfer_remark: 'Commission Withdrawal'
};

const bodyStr1 = JSON.stringify(body1);
const bodyStr2 = JSON.stringify(body2);

console.log('中文bodyStr:', bodyStr1);
console.log('中文bodyStr长度:', bodyStr1.length);
console.log('是否包含非ASCII:', /[^\x00-\x7F]/.test(bodyStr1));

console.log('\n英文bodyStr:', bodyStr2);
console.log('英文bodyStr长度:', bodyStr2.length);
console.log('是否包含非ASCII:', /[^\x00-\x7F]/.test(bodyStr2));

// 测试换行符位置
const body = {
  appid: 'wxb098af698b1631f9',
  out_batch_no: 'test123',
  batch_name: '用户佣金提现',
  total_amount: 100,
  total_num: 1
};

const bodyStr = JSON.stringify(body);
const signatureStr = `POST\n/v3/transfer/batches\n1762745677\nnonce\n${bodyStr}\n`;

console.log('\n签名串验证:');
console.log('签名串末尾:', JSON.stringify(signatureStr.substring(signatureStr.length - 20)));
console.log('签名串是否以换行符结束:', signatureStr.endsWith('\n'));
console.log('签名串中换行符数量:', (signatureStr.match(/\n/g) || []).length);
